package com.haidechizi.designpattern.factory.simple;

/**
 * 简单工厂
 *
 * @author haidechizi
 */
public class PhoneFactory {
    /**
     * 创建产品
     *
     * @param phoneType
     * @return
     */
    public static Phone create(String phoneType) {
        if ("apple".equals(phoneType)) {
            return new ApplePhone();
        } else if ("honor".equals(phoneType)) {
            return new HonorPhone();
        } else {
            throw new IllegalArgumentException("类型：" + phoneType + "不存在，无法创建对象");
        }
    }
}

